package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter printWriter = new PrintWriter(new BufferedWriter(
                                  new OutputStreamWriter(
                                  new FileOutputStream("pw.txt", true), StandardCharsets.UTF_8)),true);

        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("请输入你想要记录的事件：输入exit结束程序");
            String str = scanner.next();
            if (str.equals("exit")){
                break;
            }else{
                printWriter.println(str);
            }
        }
        printWriter.close();

    }
}
